package uk.ac.ncl.carrent.car;

import uk.ac.ncl.carrent.*;

/**
 * 
 * @author Shiwei He
 *
 */
final class LargeCar extends AbstractCar {
	
	private static final int consume1 = 10;
	
	private static final int consume2 = 15;
	
	
	LargeCar(RegistrationNumber regNumber){
		super(regNumber, "large");
		super.setCapacity(60);
	}
	
	/**
	 * see the drive method of Car
	 */
	@Override
	public int drive(int distance){
		int consumed = 0;
		if(distance >= 0 && distance <= 50){
			consumed = distance/consume1;
		}
		else if(distance > 50){
			consumed = 50/consume1 + (distance - 50)/consume2;
		}
		else{
			throw new IllegalArgumentException("invalid distance!");
		}
		super.setCurrentFuel(super.getCurrentFuel() - consumed);
		return consumed;
	}
	
}
